<!DOCTYPE HTML>
<!--
	Hyperspace by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<title>登录页面 - 浪海博客</title>
		<meta charset="utf-8" />
		<meta name="keywords" content="浪海博客,登录页面" />
		<meta name="description" content="浪海博客的登录页面。" />
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
		<link rel="stylesheet" href="/blogs/assets/css/main.css" />
		<noscript><link rel="stylesheet" href="/blogs/assets/css/noscript.css" /></noscript>
	</head>
	<body class="is-preload">

		<!-- Header -->
			<header id="header">
				<a href="/" class="title">浪海博客</a>
				<nav>
					<ul>
						<li><a href="/">主页</a></li>
						<li><a href="/navClassify/navPage">网站导航</a></li>
					</ul>
				</nav>
			</header>

		<!-- Wrapper -->
			<div id="wrapper">

				<!-- Main -->
					<section id="main" class="wrapper">
						<div class="inner">
							<h1 class="major">登录页面（暂时仅限管理员登录）</h1>
							<div class="split style1">
								<section>
									<p id="vCodeStatus"></p>
									<form id="loginForm">
										<div class="fields">
											<div class="field half">
												<input type="text" id="username" name="username" placeholder="用户名" required="required"   />
											</div>
											<div class="field half">
												<input type="password" id="password" name="password" placeholder="用户密码" required="required"   />
											</div>
										</div>
										<div class="fields">
											<div class="field half">
												<img class="image fit" src="/user/verifyCode" id="verifyCode" />
											</div>
											<div class="field half">
												<input type="text" id="verifyCodeText" name="verifyCodeText" placeholder="验证码" required="required" />
											</div>
										</div>
										<div class="col-6 col-12-small">
											<input type="checkbox" id="remember" name="remember">
											<label for="remember">记住我（七天免登录）</label>
										</div>
									</form>
									<button id="loginVerify">登录</button>
									<button id="reset">重置</button>
								</section>
								<section>
									<ul class="contact">
										<li>
											<a href="/user/registerPage">还没有账号，点击进行注册吧！！！</a>
										</li>
										<li>
											欢迎使用浪海博客，本站会收集用户信息，登录则代表同意。
										</li>
										<li>
											规范网络发言，杜绝绝对自由。
										</li>
										<li>
											您发表的任何信息均由发布人负责，与本站无关，本站仅提供一个平台基础设施，本站仅提供正规服务，有权对违规信息审核下线或删除处理。
										</li>
									</ul>
								</section>
							</div>
						</div>
					</section>

			</div>

		<!-- Footer -->
			<footer id="footer" class="wrapper alt">
				<div class="inner">
					<ul class="menu">
						<li>&copy; <a href="http://www.langhai.cc">浪海博客</a>. All rights reserved.</li><li>个人网站 2021 ~ 2029年</li>
						<li><a href="https://gitee.com/langhai666/langhai-blog" target="_blank" >gitee</a></li>
						<li><a href="https://github.com/Allenkuzma/langhaiblogs" target="_blank" >github</a></li>
					</ul>
				</div>
			</footer>

		<!-- Scripts -->
			<script src="/blogs/assets/js/jquery.min.js"></script>
			<script src="/blogs/assets/js/jquery.scrollex.min.js"></script>
			<script src="/blogs/assets/js/jquery.scrolly.min.js"></script>
			<script src="/blogs/assets/js/browser.min.js"></script>
			<script src="/blogs/assets/js/breakpoints.min.js"></script>
			<script src="/blogs/assets/js/util.js"></script>
			<script src="/blogs/assets/js/main.js"></script>

	</body>
	<script>
		$(function() {
			// 登录校验
			$("#loginVerify").click(function () {
				$.ajax({
					url: "/user/loginEnter",
					async: true,
					type: "POST",
					data: $('#loginForm').serialize(),
					success: function (data) {
						if(data.code == 200) {
							$("#vCodeStatus").html("登录成功，1秒后为你跳转到首页。");
							setTimeout(function() {
								window.location.href = "/";
							}, 1000);
						} else {
							$("#vCodeStatus").html(data.message);
						}
					}
				})
			})

			// 清空表单数据
			$("#reset").click(function () {
				$("#loginForm")[0].reset();
			})

			// 验证码刷新
			$("#verifyCode").click(function () {
				$("#verifyCode").attr("src", "/user/verifyCode?" + new Date().getTime());
			})

			// 回车键监听登录
			$(document).keyup(function(event) {
				if(event.keyCode == 13) {
					$.ajax({
						url: "/user/loginEnter",
						async: true,
						type: "POST",
						data: $('#loginForm').serialize(),
						success: function (data) {
							if(data.code == 200) {
								$("#vCodeStatus").html("登录成功，1秒后为你跳转到首页。");
								setTimeout(function(){
									window.location.href = "/";
								}, 1000);
							} else {
								$("#vCodeStatus").html(data.message);
							}
						}
					})
				}
			});
		})
	</script>
</html>